package cn.starlightsoftware.sherly.convertor;

import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.starlightsoftware.sherly.controller.admin.permission.vo.RolePermissionRespDTO;
import cn.starlightsoftware.sherly.db.model.permission.RolePermissionDO;
import cn.starlightsoftware.sherly.utils.StreamUtil;

import java.util.List;

/**
 * @author 谷子毅
 * @date 2024/4/28
 */
@Mapper
public interface RoleConvertor {

    RoleConvertor RoleConvertor = Mappers.getMapper(RoleConvertor.class);

    static RolePermissionRespDTO buildRolePermissionRespVO(List<RolePermissionDO> rolePermissionList) {
        return new RolePermissionRespDTO().setPermissionIds(StreamUtil.toList(rolePermissionList, RolePermissionDO::getPermissionId));
    }
}
